package com.example.eshop_ssm.service.impl;

import com.example.eshop_ssm.entity.TbTypeInfo;
import com.example.eshop_ssm.mapper.TypeMapper;
import com.example.eshop_ssm.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeMapper typeMapper;

    @Override
    public List<TbTypeInfo> typeSelect() {
        return typeMapper.typeSelect();
    }

    @Override
    public boolean addTypeOne(String type_name, Integer parent_id) {
        Map<String,Object> map=new HashMap<>();
        map.put("type_name",type_name);
        map.put("parent_id",parent_id);

        return typeMapper.addTypeOne(map);
    }

    @Override
    public List<TbTypeInfo> selectOne() {
        return typeMapper.selectOne();
    }

    @Override
    public boolean deleteTypeOne(Integer type_id) {
        return typeMapper.deleteTypeOne(type_id);
    }



}

